<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<ui:composition template="./template.xhtml"
                xmlns="http://www.w3.org/1999/xhtml"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:p="http://primefaces.org/ui"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:ui="http://java.sun.com/jsf/facelets">
       
    <ui:define name="conteudo" > 
        
            <p:focus />
            
            <p:panel id="login" header="Login" visible="false"  
                     style="margin-top: 100px;width: 600px" >
                                
                <p:effect type="clip" event="load" for="login" speed="1000" rendered="#{!param.erro}">
                    <f:param name="mode" value="'show'" />  
                </p:effect>
                
                 <p:effect  type="shake" event="load" for="login" speed="100" rendered="#{param.erro}">
                    <f:param name="mode" value="'show'" />  
                 </p:effect>
            
            
            <p:panel rendered="#{param.erro}" style="margin: 15px">
                <div style="color: #f00000; text-align: center; font-weight: bold;">
                     <h:outputLabel value="Usuário e/ou senha inválido(s)." /> 
               </div>
            </p:panel>
            
            
           <form id="formLogin" action="j_spring_security_check" method="post" >

                <h:panelGrid columns="2" cellpadding="5">
                   
                    <p:outputLabel  for="j_username" value="Usuario: " /> 
                    <p:inputText  id="j_username" />
                    <p:outputLabel for="j_password" value="Senha: " />
                    <p:password id="j_password" />
                      
                </h:panelGrid>
                
                <center>
                    <p:button id="btnLogar" onclick=" $('#formLogin').submit(); return false;"  value="Entrar" />
                </center>                    
               <p:defaultCommand target="btnLogar"/>
           </form>
            
            <p:spacer width="230px" height="20px"/>
            <h:form>
            <center>
                
                <p:commandLink  ajax="false" value="Novo Cliente"  action="novoCliente"/>
                
            </center>
            </h:form>
        </p:panel>
        
        </ui:define>
</ui:composition>